package com.bf.electroplating.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bf.electroplating.pojo.dto.IdDTO;
import com.bf.electroplating.pojo.dto.environmentally.EnvironmentallyExamineDTO;
import com.bf.electroplating.pojo.dto.environmentally.EnvironmentallyExamineQueryDTO;
import com.bf.electroplating.pojo.vo.ResultVO;
import com.bf.electroplating.pojo.vo.environmentally.EnvironmentallyExamineVO;
import com.bf.electroplating.service.ComEnvironmentallyExamineService;
import com.bf.electroplating.util.idempotent.Idempotent;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 环保审批管理控制器
 */
@RestController
@RequestMapping ( "/com-environmentally-examine" )
@Tag ( name = "环保审批管理", description = "环保审批管理相关接口" )
public class ComEnvironmentallyExamineController {

	@Resource
	private ComEnvironmentallyExamineService environmentallyExamineService;

	@PostMapping ( "/page" )
	@Operation ( summary = "分页查询环保审批列表", description = "分页查询环保审批列表" )
	public ResultVO < Page < EnvironmentallyExamineVO > > pageList ( @RequestBody EnvironmentallyExamineQueryDTO queryDTO ) {
		return environmentallyExamineService.pageList ( queryDTO );
	}

	@Idempotent
	@PostMapping ( "/saveData" )
	@Operation ( summary = "新增环保审批", description = "新增环保审批" )
	public ResultVO < String > saveData ( @RequestBody @Validated EnvironmentallyExamineDTO dto ) {
		return environmentallyExamineService.saveData ( dto );
	}

	@PostMapping ( "/delete" )
	@Operation ( summary = "删除环保审批", description = "删除环保审批" )
	public ResultVO < String > delete ( @RequestBody List < String > ids ) {
		return environmentallyExamineService.delete ( ids );
	}

	@PostMapping ( "/detail" )
	@Operation ( summary = "获取环保审批详情", description = "获取环保审批详情" )
	public ResultVO < EnvironmentallyExamineVO > getDetail ( @RequestBody IdDTO  idDTO  ) {
		return environmentallyExamineService.getDetail ( idDTO.getId () );
	}
}